/**
 * jims
 */
package com.jims.master.modules.template.service;

import com.jims.master.common.persistence.Page;
import com.jims.master.common.service.CrudService;
import com.jims.master.modules.sys.utils.UserUtils;
import com.jims.master.modules.template.dao.DoctorTemplaDao;
import com.jims.master.modules.template.entity.DoctorTempla;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Service
 * @author 系统管理员
 * @version 2017-06-02
 */
@Service
@Transactional(readOnly = true)
public class DoctorTemplaService extends CrudService<DoctorTemplaDao, DoctorTempla> {
	@Autowired
	private DoctorTemplaDao doctorTemplaDao;

	public DoctorTempla get(String id) {
		return super.get(id);
	}
	
	public List<DoctorTempla> findList(DoctorTempla doctorTempla) {
		return doctorTemplaDao.findList(doctorTempla);
	}

	public List<DoctorTempla> findListTable(DoctorTempla doctorTempla) {
		return doctorTemplaDao.findListTable(doctorTempla);
	}

	public Page<DoctorTempla> findPage(Page<DoctorTempla> page, DoctorTempla doctorTempla) {
		return super.findPage(page, doctorTempla);
	}
	
	@Transactional(readOnly = false)
	public int save(DoctorTempla doctorTempla) {
		UserUtils userUtils = new UserUtils();
		doctorTempla.setOrgId(userUtils.getOrgId());
		doctorTempla.setCreatr(userUtils.getUser().getId());
		doctorTempla.setBillingDept(userUtils.getUser().getOrgDept().getId());
		return super.save(doctorTempla);
	}
	
	@Transactional(readOnly = false)
	public int delete(DoctorTempla doctorTempla) {
		return super.delete(doctorTempla);
	}
	
}